// api/modules/auth.js
import { request } from '../http'

// 登录
export const login = (credentials) => {
  return request.post('/auth/login', credentials)
}

// 注册
export const register = (userInfo) => {
  return request.post('/auth/register', userInfo)
}

// 退出登录
export const logout = () => {
  return request.post('/auth/logout')
}

// 获取用户信息
export const getUserProfile = () => {
  return request.get('/auth/profile')
}

// 刷新 token
export const refreshToken = (refreshToken) => {
  return request.post('/auth/refresh', { refreshToken })
}

// 忘记密码
export const forgotPassword = (email) => {
  return request.post('/auth/forgot-password', { email })
}

// 重置密码
export const resetPassword = (token, newPassword) => {
  return request.post('/auth/reset-password', { token, newPassword })
}